﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartMathLibrary.Simulation.LogicalGate
{
    /// <summary>
    /// This class represents a one input channel gate control.
    /// </summary>
    [Serializable]
    public abstract class OneInputGate
    {
        /// <summary>
        /// This field holds the source bytes for the logical gate operation.
        /// </summary>
        private Byte a;

        /// <summary>
        /// Initializes a new instance of the <see cref="OneInputGate"/> class.
        /// </summary>
        protected OneInputGate()
        {
            this.a = new Byte();
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="OneInputGate"/> class.
        /// </summary>
        /// <param name="a">The source bytes for the logical gate operation.</param>
        protected OneInputGate(Byte a)
        {
            this.a = a;
        }

        /// <summary>
        /// Gets or sets the source bytes for the logical gate operation.
        /// </summary>
        /// <value>The source bytes for the logical gate operation.</value>
        public Byte A
        {
            get { return a; }
            set { a = value; }
        }

        /// <summary>
        /// Gets the logical result, which is defined by the gate and the specified input value.
        /// </summary>
        /// <returns>The result of the logical gate.</returns>
        public abstract Byte GetResult();
    }
}